*******************************************************************************
* IMF programs and the glass cliff effect
*
* Date: 21 December 2023
* Contact: bernhard.reinsberg@glasgow.ac.uk 
*******************************************************************************

* Country-year data
*******************************************************************************

  use "EJPR_replication", clear

  
* Data and variables
********************

  g femsh=100*(1-maleshare_minister)
  lab var femsh "Women cabinet share (%)" 
  g feminc=d.femsh>0
  replace feminc=. if femsh==.|d.femsh==.
  lab var feminc "Woman minister appointment"

  g onset=IMFonset
  replace onset=. if IMFnn==1 & l.IMFnn==1 & (IMFonset!=1)
  g ongoing=IMFongoing
  replace ongoing=. if onset==1
  lab var onset "IMF program onset"
  lab var ongoing "Ongoing IMF program"

  g anyelec=exelec==1|legelec==1
  lab var anyelec "Any election"
  g lnbb=asinh(bb)
  lab var lnbb "Budget balance"

  
* Figures 
*********

  g IMFords=1*(IMFonset==1)+2*(IMFongoing==1)
  graph bar femsh if incid!=1, over(IMFords, relabel(1 "No IMF program" 2 "Program onset" 3 "Ongoing program")) scheme(idos) ytitle(Percentage of women ministers)
  
  ttest femsh if incid!=1, by(IMFnn) une
  ttest femsh if incid!=1, by(onset) une
  ttest femsh if incid!=1, by(ongoing) une 
  
  
* Regression tables   
*******************

  global C1  l.wdi_wip d.wdi_wip l.f_lead d.f_lead l.femsh l.anyelec l.leftany
  global C2  $C1 l.lngdppc d.lngdppc l.fh_inv d.fh_inv 
  
* Baseline result
  
  qui reghdfe feminc l.IMFnn if incid!=1, a(cid year) cl(cid)
  est store a11
  qui reghdfe feminc l.IMFnn $C1 if incid!=1, a(cid year) cl(cid)
  est store a12
  qui reghdfe feminc l.IMFnn $C2 if incid!=1, a(cid year) cl(cid)
  est store a13

** Table 1   
estout a1*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Different IMF definitions

  qui reghdfe feminc l.onset if incid!=1, a(cid year) cl(cid)
  est store a21
  qui reghdfe feminc l.onset $C1 if incid!=1, a(cid year) cl(cid)
  est store a22
  qui reghdfe feminc l.onset $C2 if incid!=1, a(cid year) cl(cid)
  est store a23
  qui reghdfe feminc l.ongoing if incid!=1, a(cid year) cl(cid)
  est store a24
  qui reghdfe feminc l.ongoing $C1 if incid!=1, a(cid year) cl(cid)
  est store a25
  qui reghdfe feminc l.ongoing $C2 if incid!=1, a(cid year) cl(cid)
  est store a26

** Table 2  
estout a2*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Robustness checks
*******************

* Descriptives 

  qui estpost su feminc IMFnn onset ongoing wdi_wip f_lead femsh anyelec leftany lngdppc fh_inv if incid!=1

** Table A1   
esttab ., cells("count mean sd min max") noobs


* Controlling for reversals 

  g femdec=d.femsh<0
  replace femdec=. if d.femsh==.
  
  qui reghdfe feminc l.IMFnn femdec if incid!=1, a(cid year) cl(cid)
  est store r11
  qui reghdfe feminc l.IMFnn $C1 femdec if incid!=1, a(cid year) cl(cid)
  est store r12
  qui reghdfe feminc l.IMFnn $C2 femdec if incid!=1, a(cid year) cl(cid)
  est store r13
  
** Table A4
estout r1*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

  
* Logged positive change of women minister share

  g lndfemsh=asinh(d.femsh)
  lab var lndfemsh "Women cabinet percentage change"
  g anypriorwomen=femsh>0
  lab var anyprior "Women previously represented in cabinet"
  
  g lnplus=lndfemsh
  replace lnplus=0 if lndfemsh<=0
  lab var lnplus "Women cabinet percentage (positive change)"
  
  global Cnet1 l.wdi_wip d.wdi_wip l.f_lead d.f_lead l.anyelec l.leftany
  global Cnet2 $Cnet1 l.lngdppc d.lngdppc l.fh_inv d.fh_inv 
  
  qui reghdfe lnplus l.IMFnn if incid!=1, a(cid year) cl(cid)
  est store r21
  qui reghdfe lnplus l.anyprior l.IMFnn $Cnet1 if incid!=1, a(cid year) cl(cid)
  est store r22
  qui reghdfe lnplus l.anyprior l.IMFnn $Cnet2 if incid!=1, a(cid year) cl(cid)
  est store r23

** Table A5   
estout r2*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


  qui reghdfe lndfemsh l.IMFnn if incid!=1, a(cid year) cl(cid)
  est store r31
  qui reghdfe lndfemsh l.anyprior l.IMFnn $Cnet1 if incid!=1, a(cid year) cl(cid)
  est store r32
  qui reghdfe lndfemsh l.anyprior l.IMFnn $Cnet2 if incid!=1, a(cid year) cl(cid)
  est store r33
  
** Table A6   
  estout r3*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* No effect on finance ministers

  qui reghdfe t_fm_m2f l.IMFnn if incid!=1, a(cid year) cl(cid)
  est store r41
  qui reghdfe t_fm_m2f l.IMFnn $C1 if incid!=1, a(cid year) cl(cid)
  est store r42
  qui reghdfe t_fm_m2f l.IMFnn $C2 if incid!=1, a(cid year) cl(cid)
  est store r43
  
** Table A7
estout r4*, drop(_*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
  
  
* Controlling for fiscal consolidation 

  qui reghdfe feminc l.IMFnn l.lnbb d.lnbb if incid!=1, a(cid year) cl(cid)
  est store r51
  qui reghdfe feminc l.IMFnn l.lnbb d.lnbb $C1 if incid!=1, a(cid year) cl(cid)
  est store r52
  qui reghdfe feminc l.IMFnn l.lnbb d.lnbb $C2 if incid!=1, a(cid year) cl(cid)
  est store r53
  
** Table A14
estout r5*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* No effect of financial crises

  qui reghdfe feminc l.crisis_LV if incid!=1, a(cid year) cl(cid)
  est store r61
  qui reghdfe feminc l.crisis_LV $C1 if incid!=1, a(cid year) cl(cid)
  est store r62
  qui reghdfe feminc l.crisis_LV $C2 if incid!=1, a(cid year) cl(cid)
  est store r63
  
** Table A15
estout r6*, drop(_cons) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Reverse causality?

  qui reghdfe IMFnn l.femsh if incid!=1, a(cid year) cl(cid)
  est store r71
  qui reghdfe IMFnn l.femsh $C2 l.s_unga3 l.reserves_WDI l.growth_WDI l.crisis_LV if incid!=1, a(cid year) cl(cid)
  est store r72
  qui reghdfe IMFnn l.femsh t_fm_m2f if incid!=1, a(cid year) cl(cid)
  est store r73
  qui reghdfe IMFnn l.femsh t_fm_m2f $C2 l.s_unga3 l.reserves_WDI l.growth_WDI l.crisis_LV if incid!=1, a(cid year) cl(cid)
  est store r74
  
** Table A16
estout r7*, drop(_* oL*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Austerity conditions and women cabinet appointments  

  egen Aust=rowtotal(BA2FP BA2SOE BA2PRI BA2LAB)
  g lnNonAust=ln(1+BA2TOT-Aust)
  g lnAust=ln(Aust+1)
  
  g lnAustOnset=lnAust*(IMFonset==1)
  g lnAustOng=lnAust*(IMFongoing==1)
  g lnNonOnset=lnNon*(IMFonset==1)
  g lnNonOng=lnNonAus*(IMFongoing==1)
  
  qui reghdfe feminc l.IMFnn l.lnAust l.lnNonAust if incid!=1, a(cid year) cl(cid)
  est store r81
  qui reghdfe feminc l.IMFnn l.lnAust l.lnNonAust $C2 if incid!=1, a(cid year) cl(cid)
  est store r82
  
** Table A18
estout r8*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Gendered control of finance ministry 

  g imff=IMFnn==1 & femfm==1
  g imfm=IMFnn==1 & femfm==0
  
  qui reghdfe feminc l.imff l.imfm if incid!=1, a(cid year) cl(cid)
  est store r91
  qui reghdfe feminc l.imff l.imfm $C1 $C2 if incid!=1, a(cid year) cl(cid)
  est store r92

** Table A20 
estout r9*, drop(_cons oL* oD*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
  

  
* Cabinet-portfolio country-year data
*******************************************************************************
  
* Data and variables 
********************
  
  use "Country_minister_year_data", clear  

  egen group=group(cid portf)
  drop if group==.
  xtset group year

  g D=mingr==1
  replace D=. if mingr==0
  lab var D "Austerity-bearing ministry"
  
  g femsh=100*(1-maleshare_min)
  
  g onset=IMFonset
  replace onset=. if IMFnn==1 & l.IMFnn==1
  g ongoing=IMFongoing
  replace ongoing=. if onset==1

  g pre4=f4.IMFnn
  g pre3=f3.IMFnn
  g pre2=f2.IMFnn
  g pre1=f.IMFnn
  g pre0=IMFnn
  forvalues v=0/4{
    replace pre`v'=0 if pre`v'==.
  }

  g lngdppc=ln(wdi_gdpcapcon2010)
  g anyelec=exelec==1|legelec==1
    
	
* Figures 
*********
	
  encode portfolio, g(p)

* Austerity-bearing ministries  

  qui reghdfe female ib16.p if incid!=1 & IMFnn==0, a(cid year) cl(cid) nocons
  est store rr1
  qui reghdfe female ib16.p if incid!=1 & IMFnn==1, a(cid year) cl(cid) nocons
  est store rr2

** Figure 2   
coefplot rr1 rr2, keep(*.p*) scheme(idos) xline(0) 
  
  
* Prestigious portfolios  (Figure A1)
  
  g PRESTIGE=prest+1
  qui reghdfe female IMFnn##ib1.PRESTIGE pre1 pre2 pre3 pre3 if incid!=1, a(cid year) cl(cid)
  coefplot, keep(*.PR*) scheme(idos) xline(0) coeflabel(0.PRESTIGE="Low prestige" 1.IMFnn#0.PRESTIGE="Low prestige::IMF program" 2.PRESTIGE="High prestige" 1.IMFnn#2.PRESTIGE="High prestige::IMF program")

* Gender-relevant portfolios (Figure A2)

  g G=genderp+1
  qui reghdfe female IMFnn##ib1.G pre1 pre2 pre3 pre3 if incid!=1, a(cid year) cl(cid)
  coefplot, keep(*.G*) scheme(idos) xline(0) coeflabel(0.G="Masculine portfolio" 1.IMFnn#0.G="Masculine portfolio::IMF program" 2.G="Feminine portfolio" 1.IMFnn#2.G="Feminine portfolio::IMF program")
  

* Regression outputs
********************

* Main result

  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store b11
  qui reghdfe female onset##D pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store b12
  qui reghdfe female ongoing##D pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store b13
  
** Table 3
estout b1*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Scope conditions 
 
  ** Low gender norms
  su vdem_gender, d
  g backward=vdem_gender<`r(p50)'
  lab var backward "Adverse gender norms"
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if backward==1 & incid!=1, a(cid year) cl(cid)
  est store b31
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if backward==0 & incid!=1, a(cid year) cl(cid)
  est store b32
  
  ** High corruption
  su v2x_pubc, d
  g corrupt=v2x_pubc>`r(p50)'
  lab var corrupt "Corrupt politics"
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if corrupt==1 & incid!=1, a(cid year) cl(cid)
  est store b33
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if corrupt==0 & incid!=1, a(cid year) cl(cid)
  est store b34
  
  ** High crisis intensity
  g dinfl=asinh(infl)
  factor Xdebt growth dinfl reserves unemp_WDI, fa(1)
  predict cindex
  lab var cindex "Crisis severity"
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if cindex>0.23 & incid!=1, a(cid year) cl(cid)
  est store b35
  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if cindex<0.23 & incid!=1, a(cid year) cl(cid)
  est store b36
  
  estout b3*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Figure 3
coefplot (b31, label(Above mean)) (b32, label(Below mean)), bylabel(Gender Equality Index) || b33 b34, bylabel(Public-sector corruption) || b35 b36, bylabel(Crisis severity) scheme(s1mono) keep(1.IMFnn#1.D) yline(0) vertical byopts(row(1))

  
* Robustness tests
******************  

* Alternative definition of austerity ministries

  g D2=D
  replace D2=1 if portfolio_1=="Ageing & Elderly"
  g D3=D
  replace D3=1 if portfolio_1=="Planning & Development"
  g D4=D
  replace D4=0 if portfolio_1=="Sports"
  
  qui reghdfe female IMFnn##D2 pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q11
  qui reghdfe female IMFnn##D3 pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q12
  qui reghdfe female IMFnn##D4 pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q13
  
** Table A9
estout q1*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Placebo check: other ministries

  g P=mingr==0
  replace P=. if mingr==1
  
  qui reghdfe female IMFnn##P pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q21
  qui reghdfe female IMFonset##P pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q22
  qui reghdfe female IMFongoing##P pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q23
  
** Table A10
estout q2*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Placebo check: random assignment
  
  g pTreat=mod(p, 2)
  replace pTreat=. if mingr==2
  
  qui reghdfe female IMFnn##pTreat pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q31
  qui reghdfe female IMFonset##pTreat pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q32
  qui reghdfe female IMFongoing##pTreat pre1 pre2 pre3 pre4 if incid!=1, a(cid year) cl(cid)
  est store q33
   
** Table A11  
estout q3*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
 

* Cabinet fixed effects

  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if incid!=1, a(leadcode year) cl(leadcode)
  est store q41
  qui reghdfe female IMFonset##D pre1 pre2 pre3 pre4 if incid!=1, a(leadcode year) cl(leadcode)
  est store q42
  qui reghdfe female IMFongoing##D pre1 pre2 pre3 pre4 if incid!=1, a(leadcode year) cl(leadcode)
  est store q43

** Table A12
estout q4*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Compounded fixed effects

  qui reghdfe female IMFnn##D pre1 pre2 pre3 pre4 if incid!=1, a(cid#year) cl(leadcode)
  est store q51
  qui reghdfe female IMFonset##D pre1 pre2 pre3 pre4 if incid!=1, a(cid#year) cl(leadcode)
  est store q52
  qui reghdfe female IMFongoing##D pre1 pre2 pre3 pre4 if incid!=1, a(cid#year) cl(leadcode)
  est store q53
  
** Table A13
estout q5*, drop(_* *0.*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


* Descriptive statistics (Table A1 - panel b)

  qui estpost su female IMFnn onset ongoing D vdem_gender v2x_pubc cindex if incid!=1
  esttab ., cells("count mean sd min max") noobs

    

* Leader-year data
*******************************************************************************

  preserve
    use "Leader_year_data", clear
    
	encode iso3, g(ccode)
    sort leadid year  
    xtset leadid year 
  
    g fem=gender=="Female"
  
    g pre4=f4.crisis_LV
    g pre3=f3.crisis_LV
    g pre2=f2.crisis_LV
    g pre1=f.crisis_LV
    g pre0=crisis_LV
    forvalues j=0/4{
    replace pre`j'=0 if pre`j'==.
    }
  
    qui reghdfe IMFprg l.crisis_LV##fem pre0 pre1 pre2 pre3 pre4, a(ccode year) cl(leadid2)
    est store l1
    qui reghdfe notmine l.crisis_LV##fem pre0 pre1 pre2 pre3 pre4, a(ccode year) cl(leadid2)
    est store l2 
    qui reghdfe start l.crisis_LV##fem pre0 pre1 pre2 pre3 pre4, a(ccode year) cl(leadid2)
    est store l3 

** Table A17	
estout l*, drop(_* *0b* *0.fem*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
    
  restore 


* Program data
*******************************************************************************

  preserve
    use "Program_data", clear
	
	qui reghdfe feminc rfa1 prefb femdec, a(countryid approval) cl(countryid)
	est store p1
	qui reghdfe feminc rfa1 prefb femdec gdpg cab usfriend elec1, a(countryid approval) cl(countryid)
	est store p2
	qui reghdfe feminc rfa1 prefb femdec gdpg cab usfriend elec1 numb_fisc, a(countryid approval) cl(countryid)
	est store p3
	
** Table A19
estout p*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

  restore 
  

** end of do file **


